package com.itheima.demo02interface;

import java.util.function.Function;

public class Demo06FunctionAndThen {
    public static void main(String[] args) {
        convert((String str) ->{
            return Integer.parseInt(str);
        }, (Integer i) -> {
            return i * 5;
        });
    }

    public static void convert(Function<String, Integer> f1, Function<Integer, Integer> f2){
        String str = "10";
//        Integer num = f1.apply(str);
//        num = f2.apply(num);

        // 效果同上
        Integer num = f1.andThen(f2).apply(str);

        System.out.println("num = " + num);

    }
}
